package com.gpframework.module.module.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gpframework.module.module.mapper.GpGramWeightMapper;
import com.gpframework.module.module.domain.GpGramWeight;
import com.gpframework.module.module.domain.vo.GpGramWeightVo;
import com.gpframework.module.module.service.IGpGramWeightService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;
/**
 * @ClassName GpGramWeight
 * @Author gpframework
 * @Date 2023-12-11
 * @Version 1.0.0
 * @Description 克重Service业务层处理
 */
@Service
public class GpGramWeightServiceImpl extends ServiceImpl<GpGramWeightMapper, GpGramWeight> implements IGpGramWeightService {



    /**
     * @Description 查询列表返回VO 用于返回给前端的列表接口
     * @Author gpframework
     * @Date 2023-12-11
     * @Param [lqw]
     * @Return List<GpGramWeightVo>
     */
    @Override
    public List<GpGramWeightVo> listVo(QueryWrapper<GpGramWeight> lqw) {
        return this.baseMapper.listVo(lqw);
    }

    /**
     * @Description 通过查询详情VO 用于返回给前端的列详情接口
     * @Author gpframework
     * @Date 2023-12-11
     * @Param [id]
     * @Return GpGramWeightVo
     */
    @Override
    public GpGramWeightVo getVoById(Long id) {
        return this.baseMapper.getVo(id);
    }

    @Override
    public boolean copy(Long id, Integer copyNum) {
        GpGramWeight gpGramWeight = this.getById(id);
        if (gpGramWeight == null) {
            return false;
        }
        for (int i = 0; i < copyNum; i++) {
            gpGramWeight.setId(null);
            this.save(gpGramWeight);
        }
        return true;
    }


}
